﻿using System.Collections.Generic;
using System.Linq;

namespace BitsOfStuff
{
    /// <summary>
    /// Function for conversion between shape to vector. Legaycy function , newer is footstep recognizer!
    /// </summary>
    public class MySectorRecognize
    {
        private List<MySelectedPoint> _mySelectedPoints;

        private double _xSegmentSize;
        private double _ySegmentSize;

        /// <summary>
        /// Start analysion of sector
        /// </summary>
        /// <param name="mySelectedPoints"></param>
        public void analyze(List<MySelectedPoint> mySelectedPoints)
        {
            _mySelectedPoints = new List<MySelectedPoint>(mySelectedPoints);
            _mySelectedPoints[0].getPoint().getX();
        }

        // ReSharper disable UnusedMember.Local
        private void createGrid()
        // ReSharper restore UnusedMember.Local
        {
            var startEndVector = new MyVector();
            startEndVector.makeVector(_mySelectedPoints[0].getPoint(), _mySelectedPoints.Last().getPoint());
            var relativeX = startEndVector.getVectorRelativeX();
            var relativeY = startEndVector.getVectorRelativeY();
            if (relativeX > relativeY * MyParameters.gridMinimalTolerance)
            {
                _xSegmentSize = relativeX / 3;
                _ySegmentSize = _xSegmentSize;
                return;
            }
            if (relativeX < relativeY * MyParameters.gridMinimalTolerance)
            {
                _ySegmentSize = relativeY / 3;
                _xSegmentSize = _ySegmentSize;
                return;
            }
            _xSegmentSize = relativeX / 3;
            _ySegmentSize = relativeY / 3;
        }
    }
}